home *** CD-ROM | disk | FTP | other *** search
/ Freelog 15 / FREELOG 15.ISO / WebMaster / Perl / PERL5106.ZIP / perl5 / ntt / NT / Eventlog.ntt next >
Encoding:
Text File  |  1996-01-31  |  1.6 KB  |  80 lines

  1. # (c) 1995 Microsoft Corporation. All rights reserved.
  2. #         Developed by hip communications inc. http://info.hip.com/info
  3.  
  4. # eventlog.ntt - Event Logging tests
  5.  
  6. #set the include path.
  7. BEGIN {
  8.  
  9. @INC = qw( ..\dll-src\ext ..\lib ..\ext );
  10.  
  11. if( Win32::IsWin95() ){
  12.         print"1..1\nok 1\n";
  13.                 die "EventLog is not supported on Windows 95 or Win32s\n";
  14.                 }
  15.  
  16. }
  17.  
  18.  
  19. use Win32::EventLog;
  20.  
  21. $bug = 1;
  22.  
  23. #accounting for test.bat
  24.  
  25. open( ME, $0 ) || die $!;
  26. $bugs = grep( /^\$bug\+\+;\n$/, <ME> );
  27. close( ME );
  28.  
  29. print "1..$bugs\n";
  30.  
  31. # test for opening an eventlog object.
  32. #
  33. #
  34.  
  35. Open Win32::EventLog( $EventObj,'', 'Eventlog') || print "not ";
  36. print "ok $bug\n";
  37. $bug++;
  38.  
  39. $number = 0;
  40. $EventObj->GetNumber( $number ) || print "not ";
  41. print "ok $bug\n";
  42. $bug++;
  43.  
  44. $Event = {
  45.     'Category' => 50,
  46.     'Source' => 'EventLog',
  47.     'Computer' => "",
  48.     'EventType' => EVENTLOG_INFORMATION_TYPE,
  49.     'EventID' => 100,
  50.     'Strings' => "Windows is good",
  51.     'Data' => 'unix',
  52.     };
  53.  
  54. $EventObj->Report( $Event ) || print "not ";
  55. print "ok $bug\n";
  56. $bug++;
  57.  
  58. $EventObj->Read( (EVENTLOG_SEEK_READ | EVENTLOG_FORWARDS_READ),$number + 1,$EventInfo) || print "not ";
  59. print "ok $bug\n";
  60. $bug++;
  61.  
  62. $eventid = $EventInfo->{'EventID'};
  63. $eventcategory = $EventInfo->{'Category'};
  64. $eventtype = $EventInfo->{'EventType'};
  65. $strings = $EventInfo->{'Strings'};
  66. $data = $EventInfo->{'Data'};
  67.  
  68. $eventid == 100 || print "not ";
  69. $eventcategory == 50 || print "not ";
  70. $eventtype == EVENTLOG_INFORMATION_TYPE || print "not ";
  71.  
  72. $strings =~/Windows is good/ || print "not ";
  73. $data eq 'unix' || print "not ";
  74.  
  75.  
  76. print "ok $bug\n";
  77. $bug++;
  78.  
  79.  
  80.